// Global Attributes

[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]

// Association Types

[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_CustomerAddress_Address_AddressID", "Address", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter), "CustomerAddress", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_SalesOrderHeader_Address_BillTo_AddressID", "Address", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter), "SalesOrderHeader", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_SalesOrderHeader_Address_ShipTo_AddressID", "Address", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter), "SalesOrderHeader", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_CustomerAddress_Customer_CustomerID", "Customer", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter), "CustomerAddress", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_SalesOrderHeader_Customer_CustomerID", "Customer", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter), "SalesOrderHeader", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_Product_ProductCategory_ProductCategoryID", "ProductCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter), "Product", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_Product_ProductModel_ProductModelID", "ProductModel", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter), "Product", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_SalesOrderDetail_Product_ProductID", "Product", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter), "SalesOrderDetail", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID", "ProductCategory", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter), "ProductCategory1", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_ProductModelProductDescription_ProductDescription_ProductDescriptionID", "ProductDescription", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter), "ProductModelProductDescription", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_ProductModelProductDescription_ProductModel_ProductModelID", "ProductModel", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter), "ProductModelProductDescription", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("SFSSampleAppModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter), "SalesOrderDetail", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter))]

namespace SFS.SampleApp.BusinessObjects.PocoAdapters
{
    using System;
    using System.Data;
    using System.Data.Objects;
    using System.Data.Objects.DataClasses;
    using System.Collections.Generic;
    using System.Reflection;
    using System.ComponentModel;
    using EFPocoAdapter;
    using EFPocoAdapter.DataClasses;

    // Entity Containers

    public partial class SFSSampleAppContextAdapter : ObjectContext, IPocoAdapterObjectContext
    {
        private static QueryTranslationCache _qtc = new QueryTranslationCache();
        static SFSSampleAppContextAdapter()
        {
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.Address), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter((global::SFS.SampleApp.BusinessObjects.Address)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.Customer), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter((global::SFS.SampleApp.BusinessObjects.Customer)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.CustomerAddress), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter((global::SFS.SampleApp.BusinessObjects.CustomerAddress)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.Product), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter((global::SFS.SampleApp.BusinessObjects.Product)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.ProductCategory), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter((global::SFS.SampleApp.BusinessObjects.ProductCategory)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.ProductDescription), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter((global::SFS.SampleApp.BusinessObjects.ProductDescription)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.ProductModel), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter((global::SFS.SampleApp.BusinessObjects.ProductModel)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.ProductModelProductDescription), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter((global::SFS.SampleApp.BusinessObjects.ProductModelProductDescription)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.SalesOrderDetail), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter((global::SFS.SampleApp.BusinessObjects.SalesOrderDetail)arg));
            _qtc.AddTypeMapping(typeof(global::SFS.SampleApp.BusinessObjects.SalesOrderHeader), typeof(global::SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter), (arg) => new global::SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter((global::SFS.SampleApp.BusinessObjects.SalesOrderHeader)arg));
        }
        public SFSSampleAppContextAdapter() : base("name=SFSSampleAppContext", "SFSSampleAppContext") { OnContextCreated(); }
        public SFSSampleAppContextAdapter(string connectionString) : base(connectionString, "SFSSampleAppContext") { OnContextCreated(); }
        public SFSSampleAppContextAdapter(System.Data.EntityClient.EntityConnection connection) : base(connection, "SFSSampleAppContext") { OnContextCreated(); }
        partial void OnContextCreated();
        public QueryTranslationCache QueryTranslationCache
        {
            get { return _qtc; }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> _Addresses;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> Addresses
        {
            get
            {
                if (_Addresses == null)
                    _Addresses = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter>("[Addresses]");
                return _Addresses;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter> _Customers;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter> Customers
        {
            get
            {
                if (_Customers == null)
                    _Customers = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter>("[Customers]");
                return _Customers;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter> _CustomerAddresses;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter> CustomerAddresses
        {
            get
            {
                if (_CustomerAddresses == null)
                    _CustomerAddresses = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter>("[CustomerAddresses]");
                return _CustomerAddresses;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> _Products;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> Products
        {
            get
            {
                if (_Products == null)
                    _Products = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter>("[Products]");
                return _Products;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> _ProductCategories;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> ProductCategories
        {
            get
            {
                if (_ProductCategories == null)
                    _ProductCategories = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter>("[ProductCategories]");
                return _ProductCategories;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter> _ProductDescriptions;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter> ProductDescriptions
        {
            get
            {
                if (_ProductDescriptions == null)
                    _ProductDescriptions = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter>("[ProductDescriptions]");
                return _ProductDescriptions;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter> _ProductModels;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter> ProductModels
        {
            get
            {
                if (_ProductModels == null)
                    _ProductModels = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter>("[ProductModels]");
                return _ProductModels;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter> _ProductModelProductDescriptions;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter> ProductModelProductDescriptions
        {
            get
            {
                if (_ProductModelProductDescriptions == null)
                    _ProductModelProductDescriptions = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter>("[ProductModelProductDescriptions]");
                return _ProductModelProductDescriptions;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter> _SalesOrderDetails;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter> SalesOrderDetails
        {
            get
            {
                if (_SalesOrderDetails == null)
                    _SalesOrderDetails = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter>("[SalesOrderDetails]");
                return _SalesOrderDetails;
            }
        }

        private System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> _SalesOrderHeaders;
        public System.Data.Objects.ObjectQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> SalesOrderHeaders
        {
            get
            {
                if (_SalesOrderHeaders == null)
                    _SalesOrderHeaders = base.CreateQuery<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter>("[SalesOrderHeaders]");
                return _SalesOrderHeaders;
            }
        }
    }

    // POCO Adapters for Entity Types

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="Address")]
    public partial class AddressAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.Address>, IPocoAdapter<SFS.SampleApp.BusinessObjects.Address>
    {
        private String _AddressLine1;
        private String _AddressLine2;
        private String _City;
        private String _StateProvince;
        private String _CountryRegion;
        private String _PostalCode;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public AddressAdapter() { OnAdapterCreated(); }
        public AddressAdapter(SFS.SampleApp.BusinessObjects.Address pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.Address(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.AddressProxy(this); }
        public override void Init()
        {
            base.Init();
            this.CustomerAddresses.AssociationChanged += CustomerAddresses_Changed;
            this.SalesOrderHeaders.AssociationChanged += SalesOrderHeaders_Changed;
            this.SalesOrderHeaders1.AssociationChanged += SalesOrderHeaders1_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
            if (PocoEntity.CustomerAddresses == null)
            {
                PocoEntity.CustomerAddresses = new TrackableCollection<SFS.SampleApp.BusinessObjects.CustomerAddress>();
            }
            if (PocoEntity.SalesOrderHeaders == null)
            {
                PocoEntity.SalesOrderHeaders = new TrackableCollection<SFS.SampleApp.BusinessObjects.SalesOrderHeader>();
            }
            if (PocoEntity.SalesOrderHeaders1 == null)
            {
                PocoEntity.SalesOrderHeaders1 = new TrackableCollection<SFS.SampleApp.BusinessObjects.SalesOrderHeader>();
            }
        }
        void CustomerAddresses_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.CustomerAddresses.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.CustomerAddresses.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.CustomerAddresses, this.CustomerAddresses);
                    break;
            }
        }
        void SalesOrderHeaders_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.SalesOrderHeaders.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.SalesOrderHeaders.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.SalesOrderHeaders, this.SalesOrderHeaders);
                    break;
            }
        }
        void SalesOrderHeaders1_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.SalesOrderHeaders1.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.SalesOrderHeaders1.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.SalesOrderHeaders1, this.SalesOrderHeaders1);
                    break;
            }
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.AddressID, ref _AddressID, "AddressID");
            DetectChanges(PocoEntity.AddressLine1, ref _AddressLine1, "AddressLine1");
            DetectChanges(PocoEntity.AddressLine2, ref _AddressLine2, "AddressLine2");
            DetectChanges(PocoEntity.City, ref _City, "City");
            DetectChanges(PocoEntity.StateProvince, ref _StateProvince, "StateProvince");
            DetectChanges(PocoEntity.CountryRegion, ref _CountryRegion, "CountryRegion");
            DetectChanges(PocoEntity.PostalCode, ref _PostalCode, "PostalCode");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.CustomerAddresses, this.CustomerAddresses, "CustomerAddresses");
            DetectChanges(PocoEntity.SalesOrderHeaders, this.SalesOrderHeaders, "SalesOrderHeaders");
            DetectChanges(PocoEntity.SalesOrderHeaders1, this.SalesOrderHeaders1, "SalesOrderHeaders1");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.Address(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.AddressProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.AddressID = _AddressID;
            PocoEntity.AddressLine1 = _AddressLine1;
            PocoEntity.AddressLine2 = _AddressLine2;
            PocoEntity.City = _City;
            PocoEntity.StateProvince = _StateProvince;
            PocoEntity.CountryRegion = _CountryRegion;
            PocoEntity.PostalCode = _PostalCode;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            UpdateCollection(PocoEntity.CustomerAddresses, this.CustomerAddresses);
            UpdateCollection(PocoEntity.SalesOrderHeaders, this.SalesOrderHeaders);
            UpdateCollection(PocoEntity.SalesOrderHeaders1, this.SalesOrderHeaders1);
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _AddressID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 AddressID
        {
            get
            {
                return _AddressID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.AddressID = value;
                }
                ReportPropertyChanging("AddressID");
                _AddressID = value;
                ReportPropertyChanged("AddressID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String AddressLine1
        {
            get
            {
                return _AddressLine1;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.AddressLine1 = value;
                }
                ReportPropertyChanging("AddressLine1");
                _AddressLine1 = value;
                ReportPropertyChanged("AddressLine1");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String AddressLine2
        {
            get
            {
                return _AddressLine2;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.AddressLine2 = value;
                }
                ReportPropertyChanging("AddressLine2");
                _AddressLine2 = value;
                ReportPropertyChanged("AddressLine2");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String City
        {
            get
            {
                return _City;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.City = value;
                }
                ReportPropertyChanging("City");
                _City = value;
                ReportPropertyChanged("City");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String StateProvince
        {
            get
            {
                return _StateProvince;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.StateProvince = value;
                }
                ReportPropertyChanging("StateProvince");
                _StateProvince = value;
                ReportPropertyChanged("StateProvince");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String CountryRegion
        {
            get
            {
                return _CountryRegion;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.CountryRegion = value;
                }
                ReportPropertyChanging("CountryRegion");
                _CountryRegion = value;
                ReportPropertyChanged("CountryRegion");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.PostalCode = value;
                }
                ReportPropertyChanging("PostalCode");
                _PostalCode = value;
                ReportPropertyChanged("PostalCode");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_CustomerAddress_Address_AddressID", "CustomerAddress")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter> CustomerAddresses
        {
            get
            {
                if (_CustomerAddressesCollectionCache == null)
                    _CustomerAddressesCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter>("FK_CustomerAddress_Address_AddressID", "CustomerAddress");
                 return _CustomerAddressesCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter> _CustomerAddressesCollectionCache = null;

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderHeader_Address_BillTo_AddressID", "SalesOrderHeader")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> SalesOrderHeaders
        {
            get
            {
                if (_SalesOrderHeadersCollectionCache == null)
                    _SalesOrderHeadersCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter>("FK_SalesOrderHeader_Address_BillTo_AddressID", "SalesOrderHeader");
                 return _SalesOrderHeadersCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> _SalesOrderHeadersCollectionCache = null;

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderHeader_Address_ShipTo_AddressID", "SalesOrderHeader")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> SalesOrderHeaders1
        {
            get
            {
                if (_SalesOrderHeaders1CollectionCache == null)
                    _SalesOrderHeaders1CollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter>("FK_SalesOrderHeader_Address_ShipTo_AddressID", "SalesOrderHeader");
                 return _SalesOrderHeaders1CollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> _SalesOrderHeaders1CollectionCache = null;
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="Customer")]
    public partial class CustomerAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.Customer>, IPocoAdapter<SFS.SampleApp.BusinessObjects.Customer>
    {
        private Boolean _NameStyle;
        private String _Title;
        private String _FirstName;
        private String _MiddleName;
        private String _LastName;
        private String _Suffix;
        private String _CompanyName;
        private String _SalesPerson;
        private String _EmailAddress;
        private String _Phone;
        private String _PasswordHash;
        private String _PasswordSalt;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public CustomerAdapter() { OnAdapterCreated(); }
        public CustomerAdapter(SFS.SampleApp.BusinessObjects.Customer pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.Customer(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.CustomerProxy(this); }
        public override void Init()
        {
            base.Init();
            this.CustomerAddresses.AssociationChanged += CustomerAddresses_Changed;
            this.SalesOrderHeaders.AssociationChanged += SalesOrderHeaders_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
            if (PocoEntity.CustomerAddresses == null)
            {
                PocoEntity.CustomerAddresses = new TrackableCollection<SFS.SampleApp.BusinessObjects.CustomerAddress>();
            }
            if (PocoEntity.SalesOrderHeaders == null)
            {
                PocoEntity.SalesOrderHeaders = new TrackableCollection<SFS.SampleApp.BusinessObjects.SalesOrderHeader>();
            }
        }
        void CustomerAddresses_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.CustomerAddresses.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.CustomerAddresses.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.CustomerAddresses, this.CustomerAddresses);
                    break;
            }
        }
        void SalesOrderHeaders_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.SalesOrderHeaders.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.SalesOrderHeaders.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.SalesOrderHeaders, this.SalesOrderHeaders);
                    break;
            }
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.CustomerID, ref _CustomerID, "CustomerID");
            DetectChanges(PocoEntity.NameStyle, ref _NameStyle, "NameStyle");
            DetectChanges(PocoEntity.Title, ref _Title, "Title");
            DetectChanges(PocoEntity.FirstName, ref _FirstName, "FirstName");
            DetectChanges(PocoEntity.MiddleName, ref _MiddleName, "MiddleName");
            DetectChanges(PocoEntity.LastName, ref _LastName, "LastName");
            DetectChanges(PocoEntity.Suffix, ref _Suffix, "Suffix");
            DetectChanges(PocoEntity.CompanyName, ref _CompanyName, "CompanyName");
            DetectChanges(PocoEntity.SalesPerson, ref _SalesPerson, "SalesPerson");
            DetectChanges(PocoEntity.EmailAddress, ref _EmailAddress, "EmailAddress");
            DetectChanges(PocoEntity.Phone, ref _Phone, "Phone");
            DetectChanges(PocoEntity.PasswordHash, ref _PasswordHash, "PasswordHash");
            DetectChanges(PocoEntity.PasswordSalt, ref _PasswordSalt, "PasswordSalt");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.CustomerAddresses, this.CustomerAddresses, "CustomerAddresses");
            DetectChanges(PocoEntity.SalesOrderHeaders, this.SalesOrderHeaders, "SalesOrderHeaders");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.Customer(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.CustomerProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.CustomerID = _CustomerID;
            PocoEntity.NameStyle = _NameStyle;
            PocoEntity.Title = _Title;
            PocoEntity.FirstName = _FirstName;
            PocoEntity.MiddleName = _MiddleName;
            PocoEntity.LastName = _LastName;
            PocoEntity.Suffix = _Suffix;
            PocoEntity.CompanyName = _CompanyName;
            PocoEntity.SalesPerson = _SalesPerson;
            PocoEntity.EmailAddress = _EmailAddress;
            PocoEntity.Phone = _Phone;
            PocoEntity.PasswordHash = _PasswordHash;
            PocoEntity.PasswordSalt = _PasswordSalt;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            UpdateCollection(PocoEntity.CustomerAddresses, this.CustomerAddresses);
            UpdateCollection(PocoEntity.SalesOrderHeaders, this.SalesOrderHeaders);
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _CustomerID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.CustomerID = value;
                }
                ReportPropertyChanging("CustomerID");
                _CustomerID = value;
                ReportPropertyChanged("CustomerID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Boolean NameStyle
        {
            get
            {
                return _NameStyle;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.NameStyle = value;
                }
                ReportPropertyChanging("NameStyle");
                _NameStyle = value;
                ReportPropertyChanged("NameStyle");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Title = value;
                }
                ReportPropertyChanging("Title");
                _Title = value;
                ReportPropertyChanged("Title");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.FirstName = value;
                }
                ReportPropertyChanging("FirstName");
                _FirstName = value;
                ReportPropertyChanged("FirstName");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String MiddleName
        {
            get
            {
                return _MiddleName;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.MiddleName = value;
                }
                ReportPropertyChanging("MiddleName");
                _MiddleName = value;
                ReportPropertyChanged("MiddleName");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.LastName = value;
                }
                ReportPropertyChanging("LastName");
                _LastName = value;
                ReportPropertyChanged("LastName");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String Suffix
        {
            get
            {
                return _Suffix;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Suffix = value;
                }
                ReportPropertyChanging("Suffix");
                _Suffix = value;
                ReportPropertyChanged("Suffix");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.CompanyName = value;
                }
                ReportPropertyChanging("CompanyName");
                _CompanyName = value;
                ReportPropertyChanged("CompanyName");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String SalesPerson
        {
            get
            {
                return _SalesPerson;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SalesPerson = value;
                }
                ReportPropertyChanging("SalesPerson");
                _SalesPerson = value;
                ReportPropertyChanged("SalesPerson");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String EmailAddress
        {
            get
            {
                return _EmailAddress;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.EmailAddress = value;
                }
                ReportPropertyChanging("EmailAddress");
                _EmailAddress = value;
                ReportPropertyChanged("EmailAddress");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Phone = value;
                }
                ReportPropertyChanging("Phone");
                _Phone = value;
                ReportPropertyChanged("Phone");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String PasswordHash
        {
            get
            {
                return _PasswordHash;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.PasswordHash = value;
                }
                ReportPropertyChanging("PasswordHash");
                _PasswordHash = value;
                ReportPropertyChanged("PasswordHash");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String PasswordSalt
        {
            get
            {
                return _PasswordSalt;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.PasswordSalt = value;
                }
                ReportPropertyChanging("PasswordSalt");
                _PasswordSalt = value;
                ReportPropertyChanged("PasswordSalt");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_CustomerAddress_Customer_CustomerID", "CustomerAddress")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter> CustomerAddresses
        {
            get
            {
                if (_CustomerAddressesCollectionCache == null)
                    _CustomerAddressesCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter>("FK_CustomerAddress_Customer_CustomerID", "CustomerAddress");
                 return _CustomerAddressesCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter> _CustomerAddressesCollectionCache = null;

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderHeader_Customer_CustomerID", "SalesOrderHeader")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> SalesOrderHeaders
        {
            get
            {
                if (_SalesOrderHeadersCollectionCache == null)
                    _SalesOrderHeadersCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter>("FK_SalesOrderHeader_Customer_CustomerID", "SalesOrderHeader");
                 return _SalesOrderHeadersCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> _SalesOrderHeadersCollectionCache = null;
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="CustomerAddress")]
    public partial class CustomerAddressAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.CustomerAddress>, IPocoAdapter<SFS.SampleApp.BusinessObjects.CustomerAddress>
    {
        private String _AddressType;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public CustomerAddressAdapter() { OnAdapterCreated(); }
        public CustomerAddressAdapter(SFS.SampleApp.BusinessObjects.CustomerAddress pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.CustomerAddress(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.CustomerAddressProxy(this); }
        public override void Init()
        {
            base.Init();
            this.AddressReference.AssociationChanged += Address_Changed;
            this.CustomerReference.AssociationChanged += Customer_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
        }
        void Address_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.Address = this.Address.GetPocoEntityOrNull();
        }
        void Customer_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.Customer = this.Customer.GetPocoEntityOrNull();
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.CustomerID, ref _CustomerID, "CustomerID");
            DetectChanges(PocoEntity.AddressID, ref _AddressID, "AddressID");
            DetectChanges(PocoEntity.AddressType, ref _AddressType, "AddressType");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.Address, this.AddressReference, "Address");
            DetectChanges(PocoEntity.Customer, this.CustomerReference, "Customer");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.CustomerAddress(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.CustomerAddressProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.CustomerID = _CustomerID;
            PocoEntity.AddressID = _AddressID;
            PocoEntity.AddressType = _AddressType;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            PocoEntity.Address = this.AddressReference.Value.GetPocoEntityOrNull();
            PocoEntity.Customer = this.CustomerReference.Value.GetPocoEntityOrNull();
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _CustomerID;
        private Int32 _AddressID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.CustomerID = value;
                }
                ReportPropertyChanging("CustomerID");
                _CustomerID = value;
                ReportPropertyChanged("CustomerID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 AddressID
        {
            get
            {
                return _AddressID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.AddressID = value;
                }
                ReportPropertyChanging("AddressID");
                _AddressID = value;
                ReportPropertyChanged("AddressID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String AddressType
        {
            get
            {
                return _AddressType;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.AddressType = value;
                }
                ReportPropertyChanging("AddressType");
                _AddressType = value;
                ReportPropertyChanged("AddressType");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_CustomerAddress_Address_AddressID", "Address")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter Address
        {
            get { return this.AddressReference.Value; }
            set { this.AddressReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> _AddressReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> AddressReference
        {
            get
            {
                if (_AddressReferenceCache == null)
                    _AddressReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter>("FK_CustomerAddress_Address_AddressID", "Address");
                return _AddressReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_CustomerAddress_Customer_CustomerID", "Customer")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter Customer
        {
            get { return this.CustomerReference.Value; }
            set { this.CustomerReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter> _CustomerReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter> CustomerReference
        {
            get
            {
                if (_CustomerReferenceCache == null)
                    _CustomerReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter>("FK_CustomerAddress_Customer_CustomerID", "Customer");
                return _CustomerReferenceCache;
            }
        }
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="Product")]
    public partial class ProductAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.Product>, IPocoAdapter<SFS.SampleApp.BusinessObjects.Product>
    {
        private String _Name;
        private String _ProductNumber;
        private String _Color;
        private Decimal _StandardCost;
        private Decimal _ListPrice;
        private String _Size;
        private Decimal? _Weight;
        private DateTime _SellStartDate;
        private DateTime? _SellEndDate;
        private DateTime? _DiscontinuedDate;
        private Byte[] _ThumbNailPhoto;
        private String _ThumbnailPhotoFileName;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public ProductAdapter() { OnAdapterCreated(); }
        public ProductAdapter(SFS.SampleApp.BusinessObjects.Product pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.Product(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.ProductProxy(this); }
        public override void Init()
        {
            base.Init();
            this.ProductCategoryReference.AssociationChanged += ProductCategory_Changed;
            this.ProductModelReference.AssociationChanged += ProductModel_Changed;
            this.SalesOrderDetails.AssociationChanged += SalesOrderDetails_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
            if (PocoEntity.SalesOrderDetails == null)
            {
                PocoEntity.SalesOrderDetails = new TrackableCollection<SFS.SampleApp.BusinessObjects.SalesOrderDetail>();
            }
        }
        void ProductCategory_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.ProductCategory = this.ProductCategory.GetPocoEntityOrNull();
        }
        void ProductModel_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.ProductModel = this.ProductModel.GetPocoEntityOrNull();
        }
        void SalesOrderDetails_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.SalesOrderDetails.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.SalesOrderDetails.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.SalesOrderDetails, this.SalesOrderDetails);
                    break;
            }
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.ProductID, ref _ProductID, "ProductID");
            DetectChanges(PocoEntity.Name, ref _Name, "Name");
            DetectChanges(PocoEntity.ProductNumber, ref _ProductNumber, "ProductNumber");
            DetectChanges(PocoEntity.Color, ref _Color, "Color");
            DetectChanges(PocoEntity.StandardCost, ref _StandardCost, "StandardCost");
            DetectChanges(PocoEntity.ListPrice, ref _ListPrice, "ListPrice");
            DetectChanges(PocoEntity.Size, ref _Size, "Size");
            DetectChanges(PocoEntity.Weight, ref _Weight, "Weight");
            DetectChanges(PocoEntity.SellStartDate, ref _SellStartDate, "SellStartDate");
            DetectChanges(PocoEntity.SellEndDate, ref _SellEndDate, "SellEndDate");
            DetectChanges(PocoEntity.DiscontinuedDate, ref _DiscontinuedDate, "DiscontinuedDate");
            DetectChanges(PocoEntity.ThumbNailPhoto, ref _ThumbNailPhoto, "ThumbNailPhoto");
            DetectChanges(PocoEntity.ThumbnailPhotoFileName, ref _ThumbnailPhotoFileName, "ThumbnailPhotoFileName");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.ProductCategory, this.ProductCategoryReference, "ProductCategory");
            DetectChanges(PocoEntity.ProductModel, this.ProductModelReference, "ProductModel");
            DetectChanges(PocoEntity.SalesOrderDetails, this.SalesOrderDetails, "SalesOrderDetails");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.Product(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.ProductProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.ProductID = _ProductID;
            PocoEntity.Name = _Name;
            PocoEntity.ProductNumber = _ProductNumber;
            PocoEntity.Color = _Color;
            PocoEntity.StandardCost = _StandardCost;
            PocoEntity.ListPrice = _ListPrice;
            PocoEntity.Size = _Size;
            PocoEntity.Weight = _Weight;
            PocoEntity.SellStartDate = _SellStartDate;
            PocoEntity.SellEndDate = _SellEndDate;
            PocoEntity.DiscontinuedDate = _DiscontinuedDate;
            PocoEntity.ThumbNailPhoto = _ThumbNailPhoto;
            PocoEntity.ThumbnailPhotoFileName = _ThumbnailPhotoFileName;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            PocoEntity.ProductCategory = this.ProductCategoryReference.Value.GetPocoEntityOrNull();
            PocoEntity.ProductModel = this.ProductModelReference.Value.GetPocoEntityOrNull();
            UpdateCollection(PocoEntity.SalesOrderDetails, this.SalesOrderDetails);
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _ProductID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ProductID = value;
                }
                ReportPropertyChanging("ProductID");
                _ProductID = value;
                ReportPropertyChanged("ProductID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Name = value;
                }
                ReportPropertyChanging("Name");
                _Name = value;
                ReportPropertyChanged("Name");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String ProductNumber
        {
            get
            {
                return _ProductNumber;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ProductNumber = value;
                }
                ReportPropertyChanging("ProductNumber");
                _ProductNumber = value;
                ReportPropertyChanged("ProductNumber");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String Color
        {
            get
            {
                return _Color;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Color = value;
                }
                ReportPropertyChanging("Color");
                _Color = value;
                ReportPropertyChanged("Color");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal StandardCost
        {
            get
            {
                return _StandardCost;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.StandardCost = value;
                }
                ReportPropertyChanging("StandardCost");
                _StandardCost = value;
                ReportPropertyChanged("StandardCost");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal ListPrice
        {
            get
            {
                return _ListPrice;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ListPrice = value;
                }
                ReportPropertyChanging("ListPrice");
                _ListPrice = value;
                ReportPropertyChanged("ListPrice");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String Size
        {
            get
            {
                return _Size;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Size = value;
                }
                ReportPropertyChanging("Size");
                _Size = value;
                ReportPropertyChanged("Size");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public Decimal? Weight
        {
            get
            {
                return _Weight;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Weight = value;
                }
                ReportPropertyChanging("Weight");
                _Weight = value;
                ReportPropertyChanged("Weight");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime SellStartDate
        {
            get
            {
                return _SellStartDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SellStartDate = value;
                }
                ReportPropertyChanging("SellStartDate");
                _SellStartDate = value;
                ReportPropertyChanged("SellStartDate");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public DateTime? SellEndDate
        {
            get
            {
                return _SellEndDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SellEndDate = value;
                }
                ReportPropertyChanging("SellEndDate");
                _SellEndDate = value;
                ReportPropertyChanged("SellEndDate");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public DateTime? DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.DiscontinuedDate = value;
                }
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = value;
                ReportPropertyChanged("DiscontinuedDate");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public Byte[] ThumbNailPhoto
        {
            get
            {
                return _ThumbNailPhoto;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ThumbNailPhoto = value;
                }
                ReportPropertyChanging("ThumbNailPhoto");
                _ThumbNailPhoto = value;
                ReportPropertyChanged("ThumbNailPhoto");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String ThumbnailPhotoFileName
        {
            get
            {
                return _ThumbnailPhotoFileName;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ThumbnailPhotoFileName = value;
                }
                ReportPropertyChanging("ThumbnailPhotoFileName");
                _ThumbnailPhotoFileName = value;
                ReportPropertyChanged("ThumbnailPhotoFileName");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_Product_ProductCategory_ProductCategoryID", "ProductCategory")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter ProductCategory
        {
            get { return this.ProductCategoryReference.Value; }
            set { this.ProductCategoryReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> _ProductCategoryReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> ProductCategoryReference
        {
            get
            {
                if (_ProductCategoryReferenceCache == null)
                    _ProductCategoryReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter>("FK_Product_ProductCategory_ProductCategoryID", "ProductCategory");
                return _ProductCategoryReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_Product_ProductModel_ProductModelID", "ProductModel")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter ProductModel
        {
            get { return this.ProductModelReference.Value; }
            set { this.ProductModelReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter> _ProductModelReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter> ProductModelReference
        {
            get
            {
                if (_ProductModelReferenceCache == null)
                    _ProductModelReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter>("FK_Product_ProductModel_ProductModelID", "ProductModel");
                return _ProductModelReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderDetail_Product_ProductID", "SalesOrderDetail")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter> SalesOrderDetails
        {
            get
            {
                if (_SalesOrderDetailsCollectionCache == null)
                    _SalesOrderDetailsCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter>("FK_SalesOrderDetail_Product_ProductID", "SalesOrderDetail");
                 return _SalesOrderDetailsCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter> _SalesOrderDetailsCollectionCache = null;
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="ProductCategory")]
    public partial class ProductCategoryAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.ProductCategory>, IPocoAdapter<SFS.SampleApp.BusinessObjects.ProductCategory>
    {
        private String _Name;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public ProductCategoryAdapter() { OnAdapterCreated(); }
        public ProductCategoryAdapter(SFS.SampleApp.BusinessObjects.ProductCategory pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.ProductCategory(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.ProductCategoryProxy(this); }
        public override void Init()
        {
            base.Init();
            this.Products.AssociationChanged += Products_Changed;
            this.ProductCategory1.AssociationChanged += ProductCategory1_Changed;
            this.ProductCategory2Reference.AssociationChanged += ProductCategory2_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
            if (PocoEntity.Products == null)
            {
                PocoEntity.Products = new TrackableCollection<SFS.SampleApp.BusinessObjects.Product>();
            }
            if (PocoEntity.ProductCategory1 == null)
            {
                PocoEntity.ProductCategory1 = new TrackableCollection<SFS.SampleApp.BusinessObjects.ProductCategory>();
            }
        }
        void Products_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.Products.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.Products.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.Products, this.Products);
                    break;
            }
        }
        void ProductCategory1_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.ProductCategory1.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.ProductCategory1.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.ProductCategory1, this.ProductCategory1);
                    break;
            }
        }
        void ProductCategory2_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.ProductCategory2 = this.ProductCategory2.GetPocoEntityOrNull();
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.ProductCategoryID, ref _ProductCategoryID, "ProductCategoryID");
            DetectChanges(PocoEntity.Name, ref _Name, "Name");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.Products, this.Products, "Products");
            DetectChanges(PocoEntity.ProductCategory1, this.ProductCategory1, "ProductCategory1");
            DetectChanges(PocoEntity.ProductCategory2, this.ProductCategory2Reference, "ProductCategory2");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.ProductCategory(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.ProductCategoryProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.ProductCategoryID = _ProductCategoryID;
            PocoEntity.Name = _Name;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            UpdateCollection(PocoEntity.Products, this.Products);
            UpdateCollection(PocoEntity.ProductCategory1, this.ProductCategory1);
            PocoEntity.ProductCategory2 = this.ProductCategory2Reference.Value.GetPocoEntityOrNull();
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _ProductCategoryID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 ProductCategoryID
        {
            get
            {
                return _ProductCategoryID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ProductCategoryID = value;
                }
                ReportPropertyChanging("ProductCategoryID");
                _ProductCategoryID = value;
                ReportPropertyChanged("ProductCategoryID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Name = value;
                }
                ReportPropertyChanging("Name");
                _Name = value;
                ReportPropertyChanged("Name");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_Product_ProductCategory_ProductCategoryID", "Product")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> Products
        {
            get
            {
                if (_ProductsCollectionCache == null)
                    _ProductsCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter>("FK_Product_ProductCategory_ProductCategoryID", "Product");
                 return _ProductsCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> _ProductsCollectionCache = null;

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID", "ProductCategory1")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> ProductCategory1
        {
            get
            {
                if (_ProductCategory1CollectionCache == null)
                    _ProductCategory1CollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter>("FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID", "ProductCategory1");
                 return _ProductCategory1CollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> _ProductCategory1CollectionCache = null;

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID", "ProductCategory")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter ProductCategory2
        {
            get { return this.ProductCategory2Reference.Value; }
            set { this.ProductCategory2Reference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> _ProductCategory2ReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter> ProductCategory2Reference
        {
            get
            {
                if (_ProductCategory2ReferenceCache == null)
                    _ProductCategory2ReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter>("FK_ProductCategory_ProductCategory_ParentProductCategoryID_ProductCategoryID", "ProductCategory");
                return _ProductCategory2ReferenceCache;
            }
        }
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="ProductDescription")]
    public partial class ProductDescriptionAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.ProductDescription>, IPocoAdapter<SFS.SampleApp.BusinessObjects.ProductDescription>
    {
        private String _Description;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public ProductDescriptionAdapter() { OnAdapterCreated(); }
        public ProductDescriptionAdapter(SFS.SampleApp.BusinessObjects.ProductDescription pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.ProductDescription(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.ProductDescriptionProxy(this); }
        public override void Init()
        {
            base.Init();
            this.ProductModelProductDescriptions.AssociationChanged += ProductModelProductDescriptions_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
            if (PocoEntity.ProductModelProductDescriptions == null)
            {
                PocoEntity.ProductModelProductDescriptions = new TrackableCollection<SFS.SampleApp.BusinessObjects.ProductModelProductDescription>();
            }
        }
        void ProductModelProductDescriptions_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.ProductModelProductDescriptions.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.ProductModelProductDescriptions.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.ProductModelProductDescriptions, this.ProductModelProductDescriptions);
                    break;
            }
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.ProductDescriptionID, ref _ProductDescriptionID, "ProductDescriptionID");
            DetectChanges(PocoEntity.Description, ref _Description, "Description");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.ProductModelProductDescriptions, this.ProductModelProductDescriptions, "ProductModelProductDescriptions");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.ProductDescription(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.ProductDescriptionProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.ProductDescriptionID = _ProductDescriptionID;
            PocoEntity.Description = _Description;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            UpdateCollection(PocoEntity.ProductModelProductDescriptions, this.ProductModelProductDescriptions);
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _ProductDescriptionID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 ProductDescriptionID
        {
            get
            {
                return _ProductDescriptionID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ProductDescriptionID = value;
                }
                ReportPropertyChanging("ProductDescriptionID");
                _ProductDescriptionID = value;
                ReportPropertyChanged("ProductDescriptionID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Description = value;
                }
                ReportPropertyChanging("Description");
                _Description = value;
                ReportPropertyChanged("Description");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_ProductModelProductDescription_ProductDescription_ProductDescriptionID", "ProductModelProductDescription")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter> ProductModelProductDescriptions
        {
            get
            {
                if (_ProductModelProductDescriptionsCollectionCache == null)
                    _ProductModelProductDescriptionsCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter>("FK_ProductModelProductDescription_ProductDescription_ProductDescriptionID", "ProductModelProductDescription");
                 return _ProductModelProductDescriptionsCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter> _ProductModelProductDescriptionsCollectionCache = null;
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="ProductModel")]
    public partial class ProductModelAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.ProductModel>, IPocoAdapter<SFS.SampleApp.BusinessObjects.ProductModel>
    {
        private String _Name;
        private String _CatalogDescription;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public ProductModelAdapter() { OnAdapterCreated(); }
        public ProductModelAdapter(SFS.SampleApp.BusinessObjects.ProductModel pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.ProductModel(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.ProductModelProxy(this); }
        public override void Init()
        {
            base.Init();
            this.Products.AssociationChanged += Products_Changed;
            this.ProductModelProductDescriptions.AssociationChanged += ProductModelProductDescriptions_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
            if (PocoEntity.Products == null)
            {
                PocoEntity.Products = new TrackableCollection<SFS.SampleApp.BusinessObjects.Product>();
            }
            if (PocoEntity.ProductModelProductDescriptions == null)
            {
                PocoEntity.ProductModelProductDescriptions = new TrackableCollection<SFS.SampleApp.BusinessObjects.ProductModelProductDescription>();
            }
        }
        void Products_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.Products.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.Products.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.Products, this.Products);
                    break;
            }
        }
        void ProductModelProductDescriptions_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.ProductModelProductDescriptions.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.ProductModelProductDescriptions.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.ProductModelProductDescriptions, this.ProductModelProductDescriptions);
                    break;
            }
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.ProductModelID, ref _ProductModelID, "ProductModelID");
            DetectChanges(PocoEntity.Name, ref _Name, "Name");
            DetectChanges(PocoEntity.CatalogDescription, ref _CatalogDescription, "CatalogDescription");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.Products, this.Products, "Products");
            DetectChanges(PocoEntity.ProductModelProductDescriptions, this.ProductModelProductDescriptions, "ProductModelProductDescriptions");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.ProductModel(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.ProductModelProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.ProductModelID = _ProductModelID;
            PocoEntity.Name = _Name;
            PocoEntity.CatalogDescription = _CatalogDescription;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            UpdateCollection(PocoEntity.Products, this.Products);
            UpdateCollection(PocoEntity.ProductModelProductDescriptions, this.ProductModelProductDescriptions);
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _ProductModelID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 ProductModelID
        {
            get
            {
                return _ProductModelID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ProductModelID = value;
                }
                ReportPropertyChanging("ProductModelID");
                _ProductModelID = value;
                ReportPropertyChanged("ProductModelID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Name = value;
                }
                ReportPropertyChanging("Name");
                _Name = value;
                ReportPropertyChanged("Name");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String CatalogDescription
        {
            get
            {
                return _CatalogDescription;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.CatalogDescription = value;
                }
                ReportPropertyChanging("CatalogDescription");
                _CatalogDescription = value;
                ReportPropertyChanged("CatalogDescription");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_Product_ProductModel_ProductModelID", "Product")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> Products
        {
            get
            {
                if (_ProductsCollectionCache == null)
                    _ProductsCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter>("FK_Product_ProductModel_ProductModelID", "Product");
                 return _ProductsCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> _ProductsCollectionCache = null;

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_ProductModelProductDescription_ProductModel_ProductModelID", "ProductModelProductDescription")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter> ProductModelProductDescriptions
        {
            get
            {
                if (_ProductModelProductDescriptionsCollectionCache == null)
                    _ProductModelProductDescriptionsCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter>("FK_ProductModelProductDescription_ProductModel_ProductModelID", "ProductModelProductDescription");
                 return _ProductModelProductDescriptionsCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter> _ProductModelProductDescriptionsCollectionCache = null;
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="ProductModelProductDescription")]
    public partial class ProductModelProductDescriptionAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.ProductModelProductDescription>, IPocoAdapter<SFS.SampleApp.BusinessObjects.ProductModelProductDescription>
    {
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public ProductModelProductDescriptionAdapter() { OnAdapterCreated(); }
        public ProductModelProductDescriptionAdapter(SFS.SampleApp.BusinessObjects.ProductModelProductDescription pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.ProductModelProductDescription(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.ProductModelProductDescriptionProxy(this); }
        public override void Init()
        {
            base.Init();
            this.ProductDescriptionReference.AssociationChanged += ProductDescription_Changed;
            this.ProductModelReference.AssociationChanged += ProductModel_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
        }
        void ProductDescription_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.ProductDescription = this.ProductDescription.GetPocoEntityOrNull();
        }
        void ProductModel_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.ProductModel = this.ProductModel.GetPocoEntityOrNull();
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.ProductModelID, ref _ProductModelID, "ProductModelID");
            DetectChanges(PocoEntity.ProductDescriptionID, ref _ProductDescriptionID, "ProductDescriptionID");
            DetectChanges(PocoEntity.Culture, ref _Culture, "Culture");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.ProductDescription, this.ProductDescriptionReference, "ProductDescription");
            DetectChanges(PocoEntity.ProductModel, this.ProductModelReference, "ProductModel");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.ProductModelProductDescription(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.ProductModelProductDescriptionProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.ProductModelID = _ProductModelID;
            PocoEntity.ProductDescriptionID = _ProductDescriptionID;
            PocoEntity.Culture = _Culture;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            PocoEntity.ProductDescription = this.ProductDescriptionReference.Value.GetPocoEntityOrNull();
            PocoEntity.ProductModel = this.ProductModelReference.Value.GetPocoEntityOrNull();
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _ProductModelID;
        private Int32 _ProductDescriptionID;
        private String _Culture;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 ProductModelID
        {
            get
            {
                return _ProductModelID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ProductModelID = value;
                }
                ReportPropertyChanging("ProductModelID");
                _ProductModelID = value;
                ReportPropertyChanged("ProductModelID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 ProductDescriptionID
        {
            get
            {
                return _ProductDescriptionID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ProductDescriptionID = value;
                }
                ReportPropertyChanging("ProductDescriptionID");
                _ProductDescriptionID = value;
                ReportPropertyChanged("ProductDescriptionID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public String Culture
        {
            get
            {
                return _Culture;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Culture = value;
                }
                ReportPropertyChanging("Culture");
                _Culture = value;
                ReportPropertyChanged("Culture");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_ProductModelProductDescription_ProductDescription_ProductDescriptionID", "ProductDescription")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter ProductDescription
        {
            get { return this.ProductDescriptionReference.Value; }
            set { this.ProductDescriptionReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter> _ProductDescriptionReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter> ProductDescriptionReference
        {
            get
            {
                if (_ProductDescriptionReferenceCache == null)
                    _ProductDescriptionReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter>("FK_ProductModelProductDescription_ProductDescription_ProductDescriptionID", "ProductDescription");
                return _ProductDescriptionReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_ProductModelProductDescription_ProductModel_ProductModelID", "ProductModel")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter ProductModel
        {
            get { return this.ProductModelReference.Value; }
            set { this.ProductModelReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter> _ProductModelReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter> ProductModelReference
        {
            get
            {
                if (_ProductModelReferenceCache == null)
                    _ProductModelReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter>("FK_ProductModelProductDescription_ProductModel_ProductModelID", "ProductModel");
                return _ProductModelReferenceCache;
            }
        }
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="SalesOrderDetail")]
    public partial class SalesOrderDetailAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.SalesOrderDetail>, IPocoAdapter<SFS.SampleApp.BusinessObjects.SalesOrderDetail>
    {
        private Int16 _OrderQty;
        private Decimal _UnitPrice;
        private Decimal _UnitPriceDiscount;
        private Decimal _LineTotal;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public SalesOrderDetailAdapter() { OnAdapterCreated(); }
        public SalesOrderDetailAdapter(SFS.SampleApp.BusinessObjects.SalesOrderDetail pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.SalesOrderDetail(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.SalesOrderDetailProxy(this); }
        public override void Init()
        {
            base.Init();
            this.ProductReference.AssociationChanged += Product_Changed;
            this.SalesOrderHeaderReference.AssociationChanged += SalesOrderHeader_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
        }
        void Product_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.Product = this.Product.GetPocoEntityOrNull();
        }
        void SalesOrderHeader_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.SalesOrderHeader = this.SalesOrderHeader.GetPocoEntityOrNull();
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.SalesOrderID, ref _SalesOrderID, "SalesOrderID");
            DetectChanges(PocoEntity.SalesOrderDetailID, ref _SalesOrderDetailID, "SalesOrderDetailID");
            DetectChanges(PocoEntity.OrderQty, ref _OrderQty, "OrderQty");
            DetectChanges(PocoEntity.UnitPrice, ref _UnitPrice, "UnitPrice");
            DetectChanges(PocoEntity.UnitPriceDiscount, ref _UnitPriceDiscount, "UnitPriceDiscount");
            DetectChanges(PocoEntity.LineTotal, ref _LineTotal, "LineTotal");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.Product, this.ProductReference, "Product");
            DetectChanges(PocoEntity.SalesOrderHeader, this.SalesOrderHeaderReference, "SalesOrderHeader");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.SalesOrderDetail(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.SalesOrderDetailProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.SalesOrderID = _SalesOrderID;
            PocoEntity.SalesOrderDetailID = _SalesOrderDetailID;
            PocoEntity.OrderQty = _OrderQty;
            PocoEntity.UnitPrice = _UnitPrice;
            PocoEntity.UnitPriceDiscount = _UnitPriceDiscount;
            PocoEntity.LineTotal = _LineTotal;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            PocoEntity.Product = this.ProductReference.Value.GetPocoEntityOrNull();
            PocoEntity.SalesOrderHeader = this.SalesOrderHeaderReference.Value.GetPocoEntityOrNull();
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _SalesOrderID;
        private Int32 _SalesOrderDetailID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 SalesOrderID
        {
            get
            {
                return _SalesOrderID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SalesOrderID = value;
                }
                ReportPropertyChanging("SalesOrderID");
                _SalesOrderID = value;
                ReportPropertyChanged("SalesOrderID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 SalesOrderDetailID
        {
            get
            {
                return _SalesOrderDetailID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SalesOrderDetailID = value;
                }
                ReportPropertyChanging("SalesOrderDetailID");
                _SalesOrderDetailID = value;
                ReportPropertyChanged("SalesOrderDetailID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Int16 OrderQty
        {
            get
            {
                return _OrderQty;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.OrderQty = value;
                }
                ReportPropertyChanging("OrderQty");
                _OrderQty = value;
                ReportPropertyChanged("OrderQty");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.UnitPrice = value;
                }
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = value;
                ReportPropertyChanged("UnitPrice");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal UnitPriceDiscount
        {
            get
            {
                return _UnitPriceDiscount;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.UnitPriceDiscount = value;
                }
                ReportPropertyChanging("UnitPriceDiscount");
                _UnitPriceDiscount = value;
                ReportPropertyChanged("UnitPriceDiscount");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal LineTotal
        {
            get
            {
                return _LineTotal;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.LineTotal = value;
                }
                ReportPropertyChanging("LineTotal");
                _LineTotal = value;
                ReportPropertyChanged("LineTotal");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderDetail_Product_ProductID", "Product")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter Product
        {
            get { return this.ProductReference.Value; }
            set { this.ProductReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> _ProductReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter> ProductReference
        {
            get
            {
                if (_ProductReferenceCache == null)
                    _ProductReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter>("FK_SalesOrderDetail_Product_ProductID", "Product");
                return _ProductReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter SalesOrderHeader
        {
            get { return this.SalesOrderHeaderReference.Value; }
            set { this.SalesOrderHeaderReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> _SalesOrderHeaderReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter> SalesOrderHeaderReference
        {
            get
            {
                if (_SalesOrderHeaderReferenceCache == null)
                    _SalesOrderHeaderReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter>("FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader");
                return _SalesOrderHeaderReferenceCache;
            }
        }
    }

    [EdmEntityType(NamespaceName="SFSSampleAppModel", Name="SalesOrderHeader")]
    public partial class SalesOrderHeaderAdapter : PocoAdapterBase<SFS.SampleApp.BusinessObjects.SalesOrderHeader>, IPocoAdapter<SFS.SampleApp.BusinessObjects.SalesOrderHeader>
    {
        private Byte _RevisionNumber;
        private DateTime _OrderDate;
        private DateTime _DueDate;
        private DateTime? _ShipDate;
        private Byte _Status;
        private Boolean _OnlineOrderFlag;
        private String _SalesOrderNumber;
        private String _PurchaseOrderNumber;
        private String _AccountNumber;
        private String _ShipMethod;
        private String _CreditCardApprovalCode;
        private Decimal _SubTotal;
        private Decimal _TaxAmt;
        private Decimal _Freight;
        private Decimal _TotalDue;
        private String _Comment;
        private Guid _rowguid;
        private DateTime _ModifiedDate;
        public SalesOrderHeaderAdapter() { OnAdapterCreated(); }
        public SalesOrderHeaderAdapter(SFS.SampleApp.BusinessObjects.SalesOrderHeader pocoObject) : base(pocoObject) { OnAdapterCreated(); }

        partial void OnAdapterCreated();
        public override object CreatePocoEntity() { return new SFS.SampleApp.BusinessObjects.SalesOrderHeader(); }
        public override object CreatePocoEntityProxy() { return new SFS.SampleApp.BusinessObjects.PocoProxies.SalesOrderHeaderProxy(this); }
        public override void Init()
        {
            base.Init();
            this.AddressReference.AssociationChanged += Address_Changed;
            this.Address1Reference.AssociationChanged += Address1_Changed;
            this.CustomerReference.AssociationChanged += Customer_Changed;
            this.SalesOrderDetails.AssociationChanged += SalesOrderDetails_Changed;
        }
        public override void InitCollections(bool enableProxies)
        {
            if (_pocoEntity == null) return;
            base.InitCollections(enableProxies);
            if (PocoEntity.SalesOrderDetails == null)
            {
                PocoEntity.SalesOrderDetails = new TrackableCollection<SFS.SampleApp.BusinessObjects.SalesOrderDetail>();
            }
        }
        void Address_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.Address = this.Address.GetPocoEntityOrNull();
        }
        void Address1_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.Address1 = this.Address1.GetPocoEntityOrNull();
        }
        void Customer_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            PocoEntity.Customer = this.Customer.GetPocoEntityOrNull();
        }
        void SalesOrderDetails_Changed(object sender, System.ComponentModel.CollectionChangeEventArgs e)
        {
            if (IsDetectingChanges) return;
            if (_pocoEntity == null) return;
            switch (e.Action)
            {
                case CollectionChangeAction.Add:
                    PocoEntity.SalesOrderDetails.Add(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Remove:
                    PocoEntity.SalesOrderDetails.Remove(((SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter)e.Element).PocoEntity);
                    break;
                case CollectionChangeAction.Refresh:
                default:
                    UpdateCollection(PocoEntity.SalesOrderDetails, this.SalesOrderDetails);
                    break;
            }
        }
        public override void DetectChanges()
        {
            base.DetectChanges();
            DetectChanges(PocoEntity.SalesOrderID, ref _SalesOrderID, "SalesOrderID");
            DetectChanges(PocoEntity.RevisionNumber, ref _RevisionNumber, "RevisionNumber");
            DetectChanges(PocoEntity.OrderDate, ref _OrderDate, "OrderDate");
            DetectChanges(PocoEntity.DueDate, ref _DueDate, "DueDate");
            DetectChanges(PocoEntity.ShipDate, ref _ShipDate, "ShipDate");
            DetectChanges(PocoEntity.Status, ref _Status, "Status");
            DetectChanges(PocoEntity.OnlineOrderFlag, ref _OnlineOrderFlag, "OnlineOrderFlag");
            DetectChanges(PocoEntity.SalesOrderNumber, ref _SalesOrderNumber, "SalesOrderNumber");
            DetectChanges(PocoEntity.PurchaseOrderNumber, ref _PurchaseOrderNumber, "PurchaseOrderNumber");
            DetectChanges(PocoEntity.AccountNumber, ref _AccountNumber, "AccountNumber");
            DetectChanges(PocoEntity.ShipMethod, ref _ShipMethod, "ShipMethod");
            DetectChanges(PocoEntity.CreditCardApprovalCode, ref _CreditCardApprovalCode, "CreditCardApprovalCode");
            DetectChanges(PocoEntity.SubTotal, ref _SubTotal, "SubTotal");
            DetectChanges(PocoEntity.TaxAmt, ref _TaxAmt, "TaxAmt");
            DetectChanges(PocoEntity.Freight, ref _Freight, "Freight");
            DetectChanges(PocoEntity.TotalDue, ref _TotalDue, "TotalDue");
            DetectChanges(PocoEntity.Comment, ref _Comment, "Comment");
            DetectChanges(PocoEntity.rowguid, ref _rowguid, "rowguid");
            DetectChanges(PocoEntity.ModifiedDate, ref _ModifiedDate, "ModifiedDate");
            DetectChanges(PocoEntity.Address, this.AddressReference, "Address");
            DetectChanges(PocoEntity.Address1, this.Address1Reference, "Address1");
            DetectChanges(PocoEntity.Customer, this.CustomerReference, "Customer");
            DetectChanges(PocoEntity.SalesOrderDetails, this.SalesOrderDetails, "SalesOrderDetails");
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        public override void PopulatePocoEntity(bool enableProxies)
        {
            if (_pocoEntity == null)
            {
                if (!enableProxies)
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.SalesOrderHeader(); // poco
                }
                else
                {
                    _pocoEntity = new SFS.SampleApp.BusinessObjects.PocoProxies.SalesOrderHeaderProxy(this); // proxy
                }
                RegisterAdapterInContext();
                InitCollections(enableProxies);
            }
            base.PopulatePocoEntity(enableProxies);
            PocoEntity.SalesOrderID = _SalesOrderID;
            PocoEntity.RevisionNumber = _RevisionNumber;
            PocoEntity.OrderDate = _OrderDate;
            PocoEntity.DueDate = _DueDate;
            PocoEntity.ShipDate = _ShipDate;
            PocoEntity.Status = _Status;
            PocoEntity.OnlineOrderFlag = _OnlineOrderFlag;
            PocoEntity.SalesOrderNumber = _SalesOrderNumber;
            PocoEntity.PurchaseOrderNumber = _PurchaseOrderNumber;
            PocoEntity.AccountNumber = _AccountNumber;
            PocoEntity.ShipMethod = _ShipMethod;
            PocoEntity.CreditCardApprovalCode = _CreditCardApprovalCode;
            PocoEntity.SubTotal = _SubTotal;
            PocoEntity.TaxAmt = _TaxAmt;
            PocoEntity.Freight = _Freight;
            PocoEntity.TotalDue = _TotalDue;
            PocoEntity.Comment = _Comment;
            PocoEntity.rowguid = _rowguid;
            PocoEntity.ModifiedDate = _ModifiedDate;
            PocoEntity.Address = this.AddressReference.Value.GetPocoEntityOrNull();
            PocoEntity.Address1 = this.Address1Reference.Value.GetPocoEntityOrNull();
            PocoEntity.Customer = this.CustomerReference.Value.GetPocoEntityOrNull();
            UpdateCollection(PocoEntity.SalesOrderDetails, this.SalesOrderDetails);
            if (!(PocoEntity is IEntityProxy))
            {
            }
        }
        private Int32 _SalesOrderID;

        [EdmScalarProperty(EntityKeyProperty=true, IsNullable=false)]
        public Int32 SalesOrderID
        {
            get
            {
                return _SalesOrderID;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SalesOrderID = value;
                }
                ReportPropertyChanging("SalesOrderID");
                _SalesOrderID = value;
                ReportPropertyChanged("SalesOrderID");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Byte RevisionNumber
        {
            get
            {
                return _RevisionNumber;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.RevisionNumber = value;
                }
                ReportPropertyChanging("RevisionNumber");
                _RevisionNumber = value;
                ReportPropertyChanged("RevisionNumber");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.OrderDate = value;
                }
                ReportPropertyChanging("OrderDate");
                _OrderDate = value;
                ReportPropertyChanged("OrderDate");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime DueDate
        {
            get
            {
                return _DueDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.DueDate = value;
                }
                ReportPropertyChanging("DueDate");
                _DueDate = value;
                ReportPropertyChanged("DueDate");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public DateTime? ShipDate
        {
            get
            {
                return _ShipDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ShipDate = value;
                }
                ReportPropertyChanging("ShipDate");
                _ShipDate = value;
                ReportPropertyChanged("ShipDate");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Byte Status
        {
            get
            {
                return _Status;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Status = value;
                }
                ReportPropertyChanging("Status");
                _Status = value;
                ReportPropertyChanged("Status");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Boolean OnlineOrderFlag
        {
            get
            {
                return _OnlineOrderFlag;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.OnlineOrderFlag = value;
                }
                ReportPropertyChanging("OnlineOrderFlag");
                _OnlineOrderFlag = value;
                ReportPropertyChanged("OnlineOrderFlag");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String SalesOrderNumber
        {
            get
            {
                return _SalesOrderNumber;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SalesOrderNumber = value;
                }
                ReportPropertyChanging("SalesOrderNumber");
                _SalesOrderNumber = value;
                ReportPropertyChanged("SalesOrderNumber");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String PurchaseOrderNumber
        {
            get
            {
                return _PurchaseOrderNumber;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.PurchaseOrderNumber = value;
                }
                ReportPropertyChanging("PurchaseOrderNumber");
                _PurchaseOrderNumber = value;
                ReportPropertyChanged("PurchaseOrderNumber");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String AccountNumber
        {
            get
            {
                return _AccountNumber;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.AccountNumber = value;
                }
                ReportPropertyChanging("AccountNumber");
                _AccountNumber = value;
                ReportPropertyChanged("AccountNumber");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public String ShipMethod
        {
            get
            {
                return _ShipMethod;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ShipMethod = value;
                }
                ReportPropertyChanging("ShipMethod");
                _ShipMethod = value;
                ReportPropertyChanged("ShipMethod");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String CreditCardApprovalCode
        {
            get
            {
                return _CreditCardApprovalCode;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.CreditCardApprovalCode = value;
                }
                ReportPropertyChanging("CreditCardApprovalCode");
                _CreditCardApprovalCode = value;
                ReportPropertyChanged("CreditCardApprovalCode");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal SubTotal
        {
            get
            {
                return _SubTotal;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.SubTotal = value;
                }
                ReportPropertyChanging("SubTotal");
                _SubTotal = value;
                ReportPropertyChanged("SubTotal");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal TaxAmt
        {
            get
            {
                return _TaxAmt;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.TaxAmt = value;
                }
                ReportPropertyChanging("TaxAmt");
                _TaxAmt = value;
                ReportPropertyChanged("TaxAmt");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Freight = value;
                }
                ReportPropertyChanging("Freight");
                _Freight = value;
                ReportPropertyChanged("Freight");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Decimal TotalDue
        {
            get
            {
                return _TotalDue;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.TotalDue = value;
                }
                ReportPropertyChanging("TotalDue");
                _TotalDue = value;
                ReportPropertyChanged("TotalDue");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=true)]
        public String Comment
        {
            get
            {
                return _Comment;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.Comment = value;
                }
                ReportPropertyChanging("Comment");
                _Comment = value;
                ReportPropertyChanged("Comment");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public Guid rowguid
        {
            get
            {
                return _rowguid;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.rowguid = value;
                }
                ReportPropertyChanging("rowguid");
                _rowguid = value;
                ReportPropertyChanged("rowguid");
            }
        }

        [EdmScalarProperty(EntityKeyProperty=false, IsNullable=false)]
        public DateTime ModifiedDate
        {
            get
            {
                return _ModifiedDate;
            }
            set
            {
                if (_pocoEntity != null)
                {
                    PocoEntity.ModifiedDate = value;
                }
                ReportPropertyChanging("ModifiedDate");
                _ModifiedDate = value;
                ReportPropertyChanged("ModifiedDate");
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderHeader_Address_BillTo_AddressID", "Address")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter Address
        {
            get { return this.AddressReference.Value; }
            set { this.AddressReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> _AddressReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> AddressReference
        {
            get
            {
                if (_AddressReferenceCache == null)
                    _AddressReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter>("FK_SalesOrderHeader_Address_BillTo_AddressID", "Address");
                return _AddressReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderHeader_Address_ShipTo_AddressID", "Address")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter Address1
        {
            get { return this.Address1Reference.Value; }
            set { this.Address1Reference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> _Address1ReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter> Address1Reference
        {
            get
            {
                if (_Address1ReferenceCache == null)
                    _Address1ReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter>("FK_SalesOrderHeader_Address_ShipTo_AddressID", "Address");
                return _Address1ReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderHeader_Customer_CustomerID", "Customer")]
        public SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter Customer
        {
            get { return this.CustomerReference.Value; }
            set { this.CustomerReference.Value = value; }
        }

        private EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter> _CustomerReferenceCache = null;
        public EntityReference<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter> CustomerReference
        {
            get
            {
                if (_CustomerReferenceCache == null)
                    _CustomerReferenceCache = GetRelatedReference<SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter>("FK_SalesOrderHeader_Customer_CustomerID", "Customer");
                return _CustomerReferenceCache;
            }
        }

        [EdmRelationshipNavigationProperty("SFSSampleAppModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")]
        public EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter> SalesOrderDetails
        {
            get
            {
                if (_SalesOrderDetailsCollectionCache == null)
                    _SalesOrderDetailsCollectionCache = GetRelatedCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter>("FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail");
                 return _SalesOrderDetailsCollectionCache;
            }
        }
        private EntityCollection<SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter> _SalesOrderDetailsCollectionCache = null;
    }
}
namespace SFS.SampleApp.BusinessObjects.PocoProxies
{
    using System;
    using System.Data;
    using System.Data.Objects;
    using System.Data.Objects.DataClasses;
    using System.Collections.Generic;
    using System.Reflection;
    using System.ComponentModel;
    using EFPocoAdapter;
    using EFPocoAdapter.DataClasses;

    public partial class AddressProxy : SFS.SampleApp.BusinessObjects.Address, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter)value; }
        }
        public AddressProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.AddressAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class CustomerProxy : SFS.SampleApp.BusinessObjects.Customer, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter)value; }
        }
        public CustomerProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class CustomerAddressProxy : SFS.SampleApp.BusinessObjects.CustomerAddress, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter)value; }
        }
        public CustomerAddressProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.CustomerAddressAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class ProductProxy : SFS.SampleApp.BusinessObjects.Product, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter)value; }
        }
        public ProductProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class ProductCategoryProxy : SFS.SampleApp.BusinessObjects.ProductCategory, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter)value; }
        }
        public ProductCategoryProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductCategoryAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class ProductDescriptionProxy : SFS.SampleApp.BusinessObjects.ProductDescription, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter)value; }
        }
        public ProductDescriptionProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductDescriptionAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class ProductModelProxy : SFS.SampleApp.BusinessObjects.ProductModel, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter)value; }
        }
        public ProductModelProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class ProductModelProductDescriptionProxy : SFS.SampleApp.BusinessObjects.ProductModelProductDescription, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter)value; }
        }
        public ProductModelProductDescriptionProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.ProductModelProductDescriptionAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class SalesOrderDetailProxy : SFS.SampleApp.BusinessObjects.SalesOrderDetail, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter)value; }
        }
        public SalesOrderDetailProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderDetailAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }

    public partial class SalesOrderHeaderProxy : SFS.SampleApp.BusinessObjects.SalesOrderHeader, IEntityProxy
    {
        SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter _adapter;
        IPocoAdapter IEntityProxy.Adapter
        {
            get { return _adapter; }
            set { _adapter = (SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter)value; }
        }
        public SalesOrderHeaderProxy(SFS.SampleApp.BusinessObjects.PocoAdapters.SalesOrderHeaderAdapter adapter) : base() { _adapter = adapter; OnProxyCreated(); }
        partial void OnProxyCreated();
    }
}
